import { createApp } from "vue";
import "./style.css";
// import App from "./test.vue";
import { createPinia } from "./pinia";
// import { createPinia } from "pinia";
import App from "./App.vue";

const pinia = createPinia();
const app = createApp(App);
pinia.use(({ store }) => {
  let local = localStorage.getItem("pinia");
  if (local) {
    store.$state = JSON.parse(local);
  }
  store.$subscribe((mutation, state) => {
    localStorage.setItem("pinia", JSON.stringify(state));
  });
});
// const plugin = {
//   install(app) {
//     console.log("install", app);
//   },
// };
// app.use(plugin);
app.use(pinia); //plugin.install
app.mount("#app");
